# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=activedirectoryenum
_pkgname=ActiveDirectoryEnumeration
__pkgname=ActiveDirectoryEnum
pkgver=0.5.0
pkgrel=9
epoch=1
pkgdesc='Enumerate AD through LDAP.'
arch=('any')
groups=('blackarch' 'blackarch-recon')
url='https://github.com/CasperGN/ActiveDirectoryEnumeration'
license=('MIT')
depends=('python' 'python-cffi' 'python-click' 'python-cryptography'
         'python-dnspython' 'python-flask' 'python-future' 'impacket'
         'python-itsdangerous' 'python-jinja' 'python-ldap3'
         'python-ldapdomaindump' 'python-markupsafe' 'python-progressbar'
         'python-pyasn1' 'python-pycparser' 'python-pycryptodomex'
         'python-pyopenssl' 'python-six' 'python-termcolor' 'python-werkzeug'
         'bloodhound-python')
makedepends=('python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${__pkgname::1}/$__pkgname/$__pkgname-$pkgver.tar.gz")
sha512sums=('0c69b466979af1f8acd94aaf0b66ad0d6342419738ab9a04c46dffb018fa27486b9e6a6810c1fabe342cbebbaf1f438dbbe11b30bb6385d23a44376c590df951')

build() {
  cd "$__pkgname-$pkgver"

  python setup.py build
}

package() {
  cd "$__pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  install -dm 755 "$pkgdir/usr/bin"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
python -m ade "\$@"
EOF

  chmod a+x "$pkgdir/usr/bin/$pkgname"
}


